package org.example.blog.Mapper;

import org.apache.ibatis.annotations.*;
import org.example.blog.pojo.Tag;
import java.util.List;

@Mapper
public interface TagMapper {
    // 查询所有标签
    @Select("select * from tag")
    List<Tag> list();

    // 新增标签
    @Insert("insert into tag(name) values(#{name})")
    void insert(Tag tag);

    // 删除标签
    @Delete("delete from tag where id = #{id}")
    void deleteById(Integer id);

    // 更新标签
    @Update("update tag set name = #{name} where id = #{id}")
    void update(Tag tag);

    //模糊查询
    @Select("select * from tag where name like concat('%',#{name},'%') ")
    List<Tag> list1(String name);
}